<?php
require 'connect/connect.php';
$page = 'main_forum';
include_once 'header.php';
?>
<a href="create_topic.php" ><button class="button" style="float: right;"> Click here  to ask a new question</button></a>
<h3>Most Recent Topics/Questions</h3>
<?php
$tbl_name = "forum_question";
$sql = "SELECT * FROM $tbl_name ORDER BY id Desc";
$result = mysql_query($sql);
?>

<table style="width: 99%">
    <tr> <th>  Topic</th><th> Brief Details</th></tr>

    <?php
    if ($result >0) {
        while ($row = mysql_fetch_assoc($result)) {
            extract($row);
            ?>
            <tr><td><a href="view_topic.php?id=<?php echo $row['id']; ?>"><?php echo $row['topic']; ?></a><br/> <?php echo "(" . $row['name'] . " ->" . $row['datetime'] . ")"; ?></td>
            <td><?php echo $row['detail']; ?><a href="view_topic.php?id=<?php echo $row['id']; ?>"> <br/>Reply</a>
                </tr>
                <?php
            }
        }
        mysql_close();
        ?>
</table>
<?php include_once 'footer.php'; ?>